Package com.python.pydev.refactoring.hyperlink

Source Code of com.python.pydev.refactoring.hyperlink.PythonHyperlink

/**
* Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Eclipse Public License (EPL).
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.python.pydev.refactoring.hyperlink;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.python.pydev.editor.PyEdit;

import com.python.pydev.refactoring.actions.PyGoToDefinition;

/**
* Hiperlink will try to open the current selected word.
*
* @author Fabio
*/
public class PythonHyperlink implements IHyperlink {

    private final IRegion fRegion;
    private PyEdit fEditor;

    public PythonHyperlink(IRegion region, PyEdit editor) {
        Assert.isNotNull(region);
        fRegion = region;
        fEditor = editor;
    }

    public IRegion getHyperlinkRegion() {
        return fRegion;
    }

    public String getHyperlinkText() {
        return null;
    }

    public String getTypeLabel() {
        return null;
    }

    /**
     * Try to find a definition and open it.
     */
    public void open() {
        PyGoToDefinition pyGoToDefinition = new PyGoToDefinition();
        pyGoToDefinition.setEditor(this.fEditor);
        pyGoToDefinition.run((IAction) null);
    }

}
TOP

Related Classes of com.python.pydev.refactoring.hyperlink.PythonHyperlink

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.